<template>
  <div>
    <van-nav-bar title="修改" left-arrow @click-left="onClickLeft" @click-right="onClickRight" right-text="保存"/>

    <div>
      <ul class="content">
        <li :class="{'active':flag==0}" @click="change(0)">
          <font style="vertical-align: inherit"
            ><font style="vertical-align: inherit">男</font></font
          >
        </li>
        <li :class="{'active':flag==1}" @click="change(1)">
          <font style="vertical-align: inherit"
            ><font style="vertical-align: inherit">女</font></font
          >
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
    import { getUserInfo , updataInfo} from "../request/http";
export default {
  data() {
    return {
        flag:0
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    change(i){
        this.flag = i
    },
    onClickRight() {
      this.upInfo({
        sex:this.flag
      })
    },
    upInfo(data){
      updataInfo(data).then(res=>{
        console.log(res);
        this.$router.push('/info')
      })
    },
  },
  computed: {
    sxe() {
      return this.$route.query.data;
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  margin-top: 0.4rem;
  width: 100%;
  background: #fff;
  .active {
    background: url()
      no-repeat 100%;
    background-size: 0.4rem 0.4rem;
    margin-right: 0.533rem;
  }
}
.content li {
  padding-left: 0.267rem;
  height: 1.333rem;
  line-height: 1.333rem;
  font-size: 0.4rem;
  color: #595959;
  position: relative;
  padding-right: 0.8rem;
}
</style>